<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>拉拉货物流有限公司</title>
		<meta name="keywords" content="拉拉货物流有限公司,汕头物流配送,汕头物流,汕头物流货运,汕头货运,全国货运,厦门物流配送,深圳物流配送,广州物流配送,物流配送,物流货运,货运配送" />
	    <meta name="description" content="拉拉货物流有限公司是一家承接全国各地门到门配送业务的专业第三方物流，为企业量身定做仓储、配送物流方案，针对大小客户配备专业项目小组进行专人专车对接。" />
	    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
	    <link rel="stylesheet" href="css/amazeui.min.css" type="text/css" />
	    <link rel="stylesheet" href="css/style.css" type="text/css" />
		<link rel="stylesheet" href="layui/css/layui.css">
	    <script type="text/javascript" src="js/jquery.min.js" ></script>
	    <script type="text/javascript" src="js/amazeui.min.js" ></script>
		<script src="layui/layui.js"></script>
	</head>
	<body>
		<header data-am-widget="header" class="am-header am-header-default header-green1">
	      <div class="am-header-left am-header-nav ">
		        <a href="javascript:history.back()" style="color: #fff;"><i class="am-icon-chevron-left"></i></a>
	        </div>
		  <h1 class="am-header-title" style="color: #fff;">修改信息表</h1>
        </header>
        <div class="jl"></div>
		<form >
        <div class="discussion">
		       	  <div class="hd">
		               <span class="avatar"> 
		               	<b class="pic loaded" style="font-weight: normal;">
		                <img src="https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=3465009254,4222527716&fm=26&gp=0.jpg" width="70px" height="70px" id="demo1">	
		                </b>
		               </span>
	                   <!-- <div class="info">
	                   	 <a href="member.html" class="green-btn">填写完成</a>
	                    </div> -->
						<button type="button" class="layui-btn layui-btn-radius layui-btn-normal" style="position: relative;left: 25px;top: 20px;" id="test1">修改头像</button>
		           </div>
       </div>
       <div style="height: 5px; background: #ddd;"></div>
       <ul class="reg-infor">
       	<li>
       		<em>*</em><span>真实姓名：</span>
       		<i class="am-icon-angle-right"></i>
       		<input type="text" name="realName" class="bt" />
       	</li>
       	<li>
       		<em>*</em><span>联系方式 ：</span>
       		<i class="am-icon-angle-right"></i>
       		<input type="text" name="tel" class="bt" />
       	</li>
       	<li>
       		<em>*</em><span>身份证号 ：</span>
       		<i class="am-icon-angle-right"></i>
       		<input type="text" name="idCard" class="bt" />
       	</li>
		<input type="hidden" name="loginId"  />
       	<li>
       		<em>*</em><span>邮箱地址 ：</span>
       		<i class="am-icon-angle-right"></i>
       		<input type="text" name="mail" class="bt" />
       	</li>
       </ul>
       <a  class="green-btn">修改完成</a>
	   <input type="text" name="icon" style="display: none;"/>
	   </form>
	</body>
	<script type="text/javascript">
		layui.use(['upload'],function(){
          var upload=layui.upload			
			
			var url= JSON.parse(sessionStorage.getItem("url"))
			var user=JSON.parse(sessionStorage.getItem("user"))
			var message=JSON.parse(sessionStorage.getItem("message"))
			var imgurl=sessionStorage.getItem("imgurl")
			if(message.icon!=null){
				$("#demo1").attr("src",imgurl+message.icon)
			}
			
			
				$("input[name='realName']").val(message.realName)
				$("input[name='tel']").val(message.tel)
				$("input[name='idCard']").val(message.idCard)
			    $("input[name='mail']").val(message.mail)
				 $("input[name='loginId']").val(message.loginId)
				//修改信息
				$(".green-btn").click(function(){
					$.ajax({
						url:url+'/user/updatemessage',
						type:'put',
						dataType:'json',
						data:$("form").serialize(),
						success:function(r){
							if(r.code==200){
								location.href='member.html'
							}
						}
					})
					
					
					
				})
			
			 //普通图片上传
			  var uploadInst = upload.render({
			    elem: '#test1'
			    ,url: url+'/upload/picture' //改成您自己的上传接口
			    ,before: function(obj){
			      //预读本地文件示例，不支持ie8
			      obj.preview(function(index, file, result){
			        $('#demo1').attr('src', result); //图片链接（base64）
			      });
			    }
			    ,done: function(res){
			      //如果上传失败
			      if(res.code==200){
			        $("input[name='icon']").val(res.data)
			      }
			      //上传成功
			    }
			    ,error: function(){
			      //演示失败状态，并实现重传
			      var demoText = $('#demoText');
			      demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
			      demoText.find('.demo-reload').on('click', function(){
			        uploadInst.upload();
			      });
			    }
			 });
			
		})
	
			
			
			
			
			
	</script>
</html>
